import React, {Component} from 'react'
import {View, Text, StyleSheet} from 'react-native'
import Girl from './girl'



export default class Boy extends Component {
  constructor(props) {
    super(props)
    this.state = {
      word: ''
    }
  }
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.text}>i am boy</Text>
        <Text style={styles.text}
          onPress={() => {
            this.props.navigator.push({
              component: Girl,
              params: {
                word: '一直玫瑰花',
                onCallback: (word) => {
                  this.setState({word: word})
                }
              }
            })
          }}
        >送给女孩一朵玫瑰花</Text>
        <Text style={styles.text}>{this.state.word}</Text>
      </View>
    )
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: 'gray',
    justifyContent: 'center'
  },
  text: {
    fontSize: 20
  }
})
